package org.scaffold.config;

import de.tototec.cmdoption.CmdCommand;
import de.tototec.cmdoption.CmdOption;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Mybatis自动生成命令行配置
 */
@CmdCommand(names = "mybatis", description = "通过表名称生成mybatis配置文件及java类")
public class MybatisGenerateConfig extends GenerateConfig {

    @CmdOption(names = {"--gen-domain", "-gen-d"}, description = "生成Domain,package:包名称,table:数据表名称",
            args = {"package", "table"}, minCount = 0, maxCount = -1, handler = DomainOptionConfigHandle.class)
    public Map<String, String> generateDomain = new LinkedHashMap<String, String>();

    @CmdOption(names = {"--gen-controller", "-gen-c"}, description = "生成Controller,package:包名称,table:数据表名称",
            args = {"package", "table"}, minCount = 0, maxCount = -1, handler = ControllerOptionConfigHandle.class)
    public Map<String, String> generateController = new LinkedHashMap<String, String>();

    @CmdOption(names = {"--gen-service", "-gen-s"}, description = "生成Service,package:包名称,table:数据表名称",
            args = {"package", "table"}, minCount = 0, maxCount = -1, handler = ServiceOptionConfigHandle.class)
    public Map<String, String> generateService = new LinkedHashMap<String, String>();

    @CmdOption(names = {"--gen-xml"}, description = "生成Xml文件,package:包名称,table:数据表名称",
            args = {"package", "table"}, minCount = 0, maxCount = -1, handler = XmlOptionConfigHandle.class)
    public Map<String, String> generateXml = new LinkedHashMap<String, String>();

    @CmdOption(names = {"--gen-mapper"}, description = "生成Mapper,package:包名称,table:数据表名称",
            args = {"package", "table"}, minCount = 0, maxCount = -1, handler = MapperOptionConfigHandle.class)
    public Map<String, String> generateMapper = new LinkedHashMap<String, String>();

    @CmdOption(names = {"--gen-all"}, description = "生成generateAll,package:包名称,table:数据表名称",
            args = {"package", "table"}, minCount = 0, maxCount = -1, handler = AllOptionConfigHandle.class)
    public Map<String, String> generateAll = new LinkedHashMap<String, String>();

    @Override
    public void clearOption() {
        super.clearOption();
        generateDomain.clear();
        generateController.clear();
        generateService.clear();
        generateXml.clear();
        generateMapper.clear();
        generateAll.clear();
    }
}
